﻿using Bouyomichan;
using NicoView.Model.Share.Speech;
using NicoView.Model.Share.Speech.Learn;
using NicoView.Model.Speech;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NicoView.Model.Platform.Speachers.Bouyomichan
{
    public sealed class BouyomichanSpeacher:SpeacherBase<GeneralLearnModel>
    {
        

        internal BouyomichanSpeacher(string name, RegexLearnDictionary regexDictionary, LearnDictionary dictionary)
            : base(regexDictionary, dictionary)
        {
            _name = name;
           

            _synthesizer = new BouyomichanSynthesizer();

            _synthesizer.GetBouyomichanPath += () =>
            {
                if (GetBouyomichanPath != null) return GetBouyomichanPath();
                return "";
            };
            
        }

        private BouyomichanSynthesizer _synthesizer;

        public static event Func<string> GetBouyomichanPath;

        protected override void Synthesize(SynthesizeArgs args)
        {
            _synthesizer.Send(args.Body);
            _synthesizer.Send(args.Name);
        }

        public override void SpeechCancel()
        {
            
        }

        public override void Dispose()
        {
            _synthesizer.Dispose();
        }

        private string _name;
        public override string Name
        {
            get
            {
                return _name;
            }
        }
    }
}
